/// \file
#ifndef FILE_path_h
#define FILE_path_h

#include "folder.h"

/// Edits the given string to remove the last file/named folder
/// from path, and sets head.
///
/// \warning if the last item is .. or . , error.
/// \param[in/out] path The path that needs to be edited.
/// \param[out] head The last item of the path. Need to be allocated or NULL.
fs_ret_t fs_cutPathHead(char* path, char * head);

/// Sets the resultInode to the named entry in folder.
///
/// Does not test to see if the name is sytaxically correct.
/// \return ERR_NOT_FOUND if not found.
fs_ret_t fs_getItemInFolderbyName(FileSystemHandle_t *fsh,inodeid_t folder,const char* itemToGet,inodeid_t *resultInode);

/// Translates the path to an inode id.
///
/// \note You will need to use other path manipulation functions
/// if you need more logic to be performed.
/// \param[in] startPos The current directory. Needed only for relative
/// paths.
/// \param[in] pathToSolve The path from startPos to finalPos
/// \param[out] containingFolder The folder containing finalPos. Set it to NULL if not needed.
/// \param[out] finalPos The position pointed by the path.
fs_ret_t fs_solvePath(FileSystemHandle_t *fsh,inodeid_t startPos,const char* pathToSolve,inodeid_t *containingFolder,inodeid_t *finalPos);

#endif // FILE_path_h
